package Practice;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Bowling {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        Map<Integer,Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            map.put(a[i],i+1);
        }
        int q = sc.nextInt();
        int[] m = new int[q];
        for (int i = 0; i < q; i++) {
            m[i] = sc.nextInt();
            System.out.println(map.getOrDefault(m[i],0));
        }
    }
}
